<template>
  <div class="seizeOrders_box">
    <!-- 头部 -->
    <div class="header">
      <div>
        <img src="~@/assets/seizeOrders/right.png" alt="" srcset="" />
      </div>
      <div class="title">预约抢单页面</div>
      <div><img src="~@/assets/seizeOrders/home.png" alt="" srcset="" /></div>
    </div>

    <div class="middle">
      <!-- logo -->
      <div class="logo_box">
        <div class="logo"></div>
      </div>
      <!-- 预约抢单 -->
      <div class="grabbing_box">
        <!-- title -->
        <div class="grabbing_title">
          <span style="font-weight: bolder">预约抢单</span>
          <span style="color: rgb(0, 126, 255)">
            <img src="~@/assets/seizeOrders/refresh.png" alt="" srcset="" />
            刷新
          </span>
        </div>
        <div class="line"></div>
        <!-- 内容 -->
        <div>
          <div style="color: rgb(113 113 113)">
            您好，您可参加的抢单，具体时段如下:
          </div>
          <div v-for="(item, index) of qiangList" :key="index">
            <div v-if="item.flag === 1">
              <span
                ><el-checkbox
                  v-model="item.checked"
                  @change="changeBox(item)"
                ></el-checkbox
              ></span>
              <span style="color: rgb(0, 126, 255)">{{ item.sTime }}</span
              >&nbsp; <span style="color: rgb(113 113 113)">至</span>&nbsp;
              <span style="color: rgb(0, 126, 255)">{{ item.eTime }}</span>
              <span
                >(还有<span style="color: red">{{ item.num }}</span
                >个名额)</span
              >
            </div>
          </div>
        </div>
      </div>
      <div class="button_box">
        <el-button @click="handleReservation" type="primary">预约</el-button>
      </div>
      <!-- 预约抢单 -->
      <div class="grabbing_box">
        <!-- title -->
        <div class="grabbing_title">
          <span style="font-weight: bolder">预约成功</span>
        </div>
        <div class="line"></div>
        <!-- 内容 -->
        <div>
          <div style="color: rgb(113 113 113)">
            您好：您已成功参加的抢单，具体时段如下：
          </div>
          <div v-for="(item, index) of qiangList" :key="index">
            <div v-if="item.flag === 1">
              <span
                ><el-checkbox
                  v-model="item.checked"
                  @change="changeBox(item)"
                ></el-checkbox
              ></span>
              <span style="color: rgb(0, 126, 255)">{{ item.sTime }}</span
              >&nbsp; <span style="color: rgb(113 113 113)">至</span>&nbsp;
              <span style="color: rgb(0, 126, 255)">{{ item.eTime }}</span>
            </div>
          </div>
        </div>
      </div>
      <div class="button_box">
        <el-button @click="HandleCancellation" type="primary"
          >取消预约</el-button
        >
      </div>
    </div>
    <!-- 预约弹框 -->
    <el-dialog
      title="预约提醒"
      :visible.sync="addDialogVisible"
      width="80%"
      :close-on-click-modal="false"
    >
      <span slot="title" class="edit-form-huidan">预约提醒</span>
      <span>预约成功!</span>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="addDialogVisible = false"
          >确 定</el-button
        >
        <el-button @click="addDialogVisible = false">取 消</el-button>
      </span>
    </el-dialog>
    <!-- 取消预约弹框 -->
    <el-dialog
      title="预约提醒"
      :visible.sync="closeDialogVisible"
      width="80%"
      :close-on-click-modal="false"
    >
      <span slot="title" class="edit-form-huidan">预约提醒</span>
      <span>取消预约成功!</span>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="closeDialogVisible = false"
          >确 定</el-button
        >
        <el-button @click="closeDialogVisible = false">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      addDialogVisible: false, //预约弹框
      closeDialogVisible: false, //取消预约弹框
      yuyueList: [], //
      qiangList: [
        {
          sTime: "2023-7-18 08:00:00",
          eTime: "10:00:00",
          num: "9",
          checked: false,
          flag: 1,
        },
        {
          sTime: "2023-7-19 08:00:00",
          eTime: "10:00:00",
          num: "12",
          checked: false,
          flag: 1,
        },
        {
          sTime: "2023-7-20 08:00:00",
          eTime: "19:00:00",
          num: "123",
          checked: false,
          flag: 1,
        },
        {
          sTime: "2023-7-23 08:00:00",
          eTime: "10:00:00",
          num: "9",
          checked: false,
          flag: 1,
        },
        {
          sTime: "2023-7-18 08:00:00",
          eTime: "10:00:00",
          num: "94",
          checked: false,
          flag: 1,
        },
        {
          sTime: "2023-7-23 08:00:00",
          eTime: "10:00:00",
          num: "9",
          checked: false,
          flag: 1,
        },
        {
          sTime: "2023-7-18 08:00:00",
          eTime: "10:00:00",
          num: "444",
          checked: false,
          flag: 0,
        },
      ],
    };
  },
  watch: {},
  activated() {},
  created() {},
  methods: {
    //选中的数据
    changeBox(obj) {
      this.yuyueList = [];
      console.log("obj=", obj);
      this.yuyueList.push(obj);
      console.log("this.yuyueList", this.yuyueList);
      console.log("this.yuyueList", this.yuyueList.length);
    },
    //预约 - 拿到可需要的数据
    handleReservation() {
      let aaa = this.qiangList.filter((d) => d.checked === true);
      console.log("aaa=", aaa);
      this.addDialogVisible = true;
    },
    //取消预约
    HandleCancellation() {
      let aaa = this.qiangList.filter((d) => d.checked === true);
      console.log("aaa=", aaa);
      this.closeDialogVisible = true;
    },
  },
  mounted() {},
};
</script>

<style lang='scss' scoped>
// body{
//     background-color: #f8f8f8;
// }
.seizeOrders_box {
  width: 100%;
  //   height: 100vh;
  min-height: 100vh;
  background-color: rgb(248, 248, 248);
  //   border: 1px solid red;
  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    // margin-top: 5px;
    padding-top: 5px;
    background-color: #fff;
    line-height: 50px;
    img {
      // width: 25px;
      // height: 25px;
    }
    .title {
      font-size: 18px;
      font-weight: bolder;
    }
  }
  .middle {
    width: 100%;
    padding: 0 10px;
  }
  .logo_box {
    // height: 75px;
    margin-top: 10px;
    .logo {
      width: 100%;
      height: 75px;
      background: url("~@/assets/seizeOrders/headerLogo.png") no-repeat;
      background-size: 60% 50%;
      background-position: 0% 50%;
    }
  }
  .line {
    border: 0.1px solid #f7f7f7;
    margin: 15px 0px 10px 0px;
  }
  .button_box {
    width: 100%;
    margin: 15px 0px;
    .el-button--medium {
      width: 100%;
    }
  }
  .grabbing_box {
    width: 100%;
    // height: 100px;
    padding: 10px 15px;
    background-color: #fff;
    border-radius: 5px;
    // border: 1px solid red;
    .grabbing_title {
      display: flex;
      justify-content: space-between;
      align-items: center;
      img {
        width: 20px;
        height: 20px;
        vertical-align: sub;
      }
    }
  }
}
.seizeOrders_box /deep/ .el-radio,
.el-checkbox {
  margin-right: 10px;
}
.seizeOrders_box /deep/ .el-dialog {
  border: 1px solid gainsboro;
  background: #f7f7f7;
  color: #000;
}
.seizeOrders_box /deep/ .el-dialog__title {
  color: #000 !important;
}
.seizeOrders_box /deep/ .el-dialog__body {
  color: #000 !important;
  text-align: center;
  font-size: 18px;
}
.seizeOrders_box /deep/ .el-dialog__headerbtn .el-dialog__close {
  color: #000 !important;
}
.seizeOrders_box /deep/ .el-dialog__header {
  // padding:10px !important;
  border-bottom: 1px solid #000;
  padding: 20px 10px 10px;
}
.edit-form-huidan {
  // border-bottom: 1px solid #000;
}
</style>